package com.ls.data.utils;

import com.alibaba.fastjson.JSONObject;


public class ResultUtils {

    public static JSONObject Result(String url) {
        JSONObject jSONObject=new JSONObject();
        String reason="调用成功";
        String resultcode="0000";
        //记录开始调用时间
        JSONObject httpGet = HttpClientUtils.httpGet(url);
        //结束的时间
        long time=20;
        if(null==httpGet) {
            reason="网络异常";
            resultcode="9999";
            jSONObject.put("reason", reason);
            jSONObject.put("resultcode", resultcode);
            //存储调用记录
            return jSONObject;
        }

        String recode = String.valueOf(httpGet.get("resultcode"));
        switch (recode) {
            case "200":
                httpGet.put("resultcode", "0000");
                httpGet.put("reason", "调用成功");
                return httpGet;
            case "202":
                httpGet.put("reason", "未查询到");
                return httpGet;
            default:
                httpGet.put("resultcode", "9000");
                httpGet.put("code", "系统故障，请联系商务人员");

                return httpGet;
        }


    }
}
